#encoding: utf-8

module UI
  # Button that show basic information of a Pokemon
  class TeamButton < SpriteStack
    def initialize(viewport, index)
      @index = index
      super(viewport, CoordinatesX[index % 2], CoordinatesY[index % 6])
      @background = push(15, 7, $options.language == "fr" ? "team/But_Party" : "team/But_PartyEN")
      @background.src_rect.height = TextureBackgroundHeight
      @icon_sp = push(32, 24, nil, type: PokemonIconSprite2)
	  add_text(50, 17, 79, 16, :given_name, type: SymText, color: 9)
      @hp = push_sprite(UI::Bar.new(viewport, @x + 64, @y + 34, RPG::Cache.interface("team/HPBars"), 53, 4, 0, 0, 3))
      # add_text(62, 34, 56, 16, :hp_pokemon_number, 2, type: SymText, color: 9)
      @font_id = 20 # trick to get SmallGreen
      add_text(62, 34 + 5, 56, 13, :hp_text, 1, type: SymText, color: 9)
      @font_id = 0
      push(132, 20, nil, type: GenderSprite)
      push(123 ,31, "team/Item", type: HoldSprite)
      add_text(38, 38, 61, 16, :level_pokemon_number, type: SymText, color: 9)
      push(119, 46, nil, type: StatusSprite)
      @item_sprite = push(24, 39, "team/But_Object", 1, 2, type: SpriteSheet)
      @item_text = add_text(27, 40, 113, 16, :item_name, type: SymText)
      hide_item_name
      @selected = false
      #> Position adjustment
      @x += 15
      @y += 7
    end
  end
end
